package com.gosophia.accountManagement.action;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.gosophia.commons.web.action.BaseAjaxAction;
import com.gosophia.userManagement.dto.UserAccountDTO;
import com.gosophia.userManagement.ws.UserManagementWebService;

@Controller("ValidateRepeatNameAction")
@Scope("prototype")
public class ValidateRepeatNameAction extends BaseAjaxAction<UserAccountDTO>{
    
    private static final long serialVersionUID = 1L;

    @Autowired
    private UserManagementWebService userManagementWebService;
    
    private UserAccountDTO userAccountDTO;

    private boolean repeatNameFlag = false;//true:重复  false:不重复
    
    @Override
    public String _execute() throws Exception {
        UserAccountDTO userAccountDTONew = userManagementWebService.findUserAccountByName(userAccountDTO.getUserAccountName());
        if(userAccountDTONew!=null)
            repeatNameFlag=true;
        super.getRequestResult().setRsltCode("0");
        return SUCCESS;
    }

    public UserAccountDTO getUserAccountDTO() {
        return userAccountDTO;
    }

    public void setUserAccountDTO(UserAccountDTO userAccountDTO) {
        this.userAccountDTO = userAccountDTO;
    }

    public boolean isRepeatNameFlag() {
        return repeatNameFlag;
    }

    public void setRepeatNameFlag(boolean repeatNameFlag) {
        this.repeatNameFlag = repeatNameFlag;
    }

    @Override
    public UserAccountDTO getDetailData() {
        // TODO Auto-generated method stub
        return null;
    }

}
